From 8c6bbcdc2ef60b63e3f6788dd9f8955075b5f1a8 Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Mon, 25 May 2020 21:27:58 -0400 Subject: [PATCH] docs: Mention shortcuts in the migration guide Add a few paragraphs about GtkAccelGroup, GtkBindingSet and GtkAccelMap to the migration guide. Fixes: #2778 --- docs/reference/gtk/migrating-3to4.md | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/docs/reference/gtk/migrating-3to4.md b/docs/reference/gtk/migrating-3to4.md index 55fc99a710..c3514e87a1 100644 --- a/docs/reference/gtk/migrating-3to4.md +++ b/docs/reference/gtk/migrating-3to4.md @@ -378,6 +378,20 @@ with gtk_container_set_focus_vadjustment() has been removed together with GtkContainer, and is provided by scrollable widgets instead. In the common case that the scrollable is a #GtkViewport, use #GtkViewport:scroll-to-focus. +### Use the new apis for keyboard shortcuts + +The APIs for keyboard shortcuts and accelerators have changed in GTK 4. + +Instead of GtkAccelGroup, you now use a #GtkShortcutController with global +scope, and instead of GtkBindingSet, you now use gtk_widget_class_add_shortcut(), +gtk_widget_class_add_binding() and its variants. In both cases, you probably +want to add actions that can be triggered by your shortcuts. + +There is no direct replacement for loading and saving accelerators with +GtkAccelMap. But since #GtkShortcutController implements #GListModel and +both #GtkShortcutTrigger and #GtkShortcutAction can be serialized to +strings, it is relatively easy to implement saving and loading yourself. + ### Stop using GtkEventBox GtkEventBox is no longer needed and has been removed. -- 2.30.2